#!/bin/sh
# script to manage nfs in a clustered environment

[ -n "$CTDB_BASE" ] || \
    CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")

. "${CTDB_BASE}/functions"

# service_name is used by various functions
# shellcheck disable=SC2034
service_name="nfs"

loadconfig
service_state_dir=$(ctdb_setup_service_state_dir) || exit $?

######################################################################

nfs_callout_pre ()
{
	_event="$1"
	shift

	nfs_callout "${_event}-pre" "$@"
}

######################################################################

nfs_callout_init "$service_state_dir"

ctdb_start_stop_service

is_ctdb_managed_service || exit 0

case "$1" in
takeip)
	nfs_callout_pre "$@"
	;;

releaseip)
	nfs_callout_pre "$@"
	;;
esac
